"""
@-*- coding: utf-8 -*-
@ python: 3.12.3
@ 创建者: JacksonCode
@ 创建时间: 2025/6/24
"""

import requests

# 请求头
headers = {
    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36'
}

title = input("请输入菜名:")
params = {
    'keyword': title,
    'cat': '1001'
}

url = "https://www.xiachufang.com/search/"

response = requests.get(url=url, headers=headers, params=params)

response.encoding = 'utf-8'  # gbk

page_text = response.text

fileName = title + '.html'
with open(fileName, 'w') as fp:
    fp.write(page_text)

